package com.wl.dzt.sys.core.dao.tree.checked;


import com.wl.dzt.sys.core.dao.datachange.DataChangeter;

import java.util.List;
import java.util.Map;


/**
 * @author wl_code@163.com
 * @version 1.0
 * @date 2018/7/5/005
 * @description 树形多选框
 * 子级都有复选框
 */
public class ChildrenCheckedModel implements DataChangeter {

    public List<Map<String, Object>> change(List<Map<String, Object>> data) {
        data.forEach(map -> {
            List<Map<String, Object>> children = (List<Map<String, Object>>) map.get("children");
            if (!children.isEmpty()) {
                this.change(children);
            }
            if (children.isEmpty()) {
                map.put("checked", false);
            }
        });
        return data;
    }

}
